package com.heima.article.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.heima.article.service.ApArticleService;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/apArticle")
public class ApArticleController {
    @Autowired
    ApArticleService articleService;
    @GetMapping("/searchChannel/{articleId}")
    private ResponseResult<ApArticle>  queryByArticleId(@PathVariable Long articleId){
        LambdaQueryWrapper<ApArticle> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ApArticle::getId,articleId);
        ApArticle apArticle = articleService.getOne(lambdaQueryWrapper);
        return ResponseResult.okResult(apArticle);
    }
}
